package com.ruoyi.message.service.impl;

import java.util.List;
import java.util.UUID;

import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.message.mapper.TVehicleFenceMapper;
import com.ruoyi.message.domain.TVehicleFence;
import com.ruoyi.message.service.ITVehicleFenceService;

/**
 * 电子围栏Service业务层处理
 *
 * @author ruoyi
 * @date 2023-05-28
 */
@Service
public class TVehicleFenceServiceImpl implements ITVehicleFenceService {
	@Autowired
	private TVehicleFenceMapper tVehicleFenceMapper;

	/**
	 * 查询电子围栏
	 *
	 * @param id 电子围栏主键
	 * @return 电子围栏
	 */
	@Override
	public TVehicleFence selectTVehicleFenceById(String id) {
		return tVehicleFenceMapper.selectTVehicleFenceById(id);
	}

	/**
	 * 查询电子围栏列表
	 *
	 * @param tVehicleFence 电子围栏
	 * @return 电子围栏
	 */
	@Override
	public List<TVehicleFence> selectTVehicleFenceList(TVehicleFence tVehicleFence) {
		return tVehicleFenceMapper.selectTVehicleFenceList(tVehicleFence);
	}

	/**
	 * 新增电子围栏
	 *
	 * @param tVehicleFence 电子围栏
	 * @return 结果
	 */
	@Override
	public int insertTVehicleFence(TVehicleFence tVehicleFence) {
                tVehicleFence.setCreateTime(DateUtils.getNowDate());
				tVehicleFence.setId(UUID.randomUUID().toString().replaceAll("-",""));
			return tVehicleFenceMapper.insertTVehicleFence(tVehicleFence);
	}

	/**
	 * 修改电子围栏
	 *
	 * @param tVehicleFence 电子围栏
	 * @return 结果
	 */
	@Override
	public int updateTVehicleFence(TVehicleFence tVehicleFence) {
                tVehicleFence.setUpdateTime(DateUtils.getNowDate());
		return tVehicleFenceMapper.updateTVehicleFence(tVehicleFence);
	}

	/**
	 * 批量删除电子围栏
	 *
	 * @param ids 需要删除的电子围栏主键
	 * @return 结果
	 */
	@Override
	public int deleteTVehicleFenceByIds(String[] ids) {
		return tVehicleFenceMapper.deleteTVehicleFenceByIds(ids);
	}

	/**
	 * 删除电子围栏信息
	 *
	 * @param id 电子围栏主键
	 * @return 结果
	 */
	@Override
	public int deleteTVehicleFenceById(String id) {
		return tVehicleFenceMapper.deleteTVehicleFenceById(id);
	}
}
